package com.bfly.core.exception;

import com.bfly.core.enums.SysError;

/**
 * 服务响应异常类
 *
 * @author 长沙商脉科技有限公司
 * @date 2019/9/18 11:05
 */
public class ServiceResponseException extends RuntimeException {

    private int code;

    public ServiceResponseException(SysError error) {
        super(error.getMessage());
        this.code = error.getCode();
    }

    public ServiceResponseException(SysError error, String message) {
        super(message);
        error = error == null ? SysError.ERROR : error;
        this.code = error.getCode();
    }

    public int getCode() {
        return code;
    }
}
